package com.gasq.community.message.kafka.config;

import org.apache.kafka.common.serialization.StringSerializer;

/**
 * 生产者统一默认配置
 * Created by mjh on 16/12/29.
 */
public class ClientProducerDefaultConfig {

    //必须：kafka集群ip配置
    private String bootstrapServers ="localhost:19092";

    //key反序列化器
    private String keySerializer = StringSerializer.class.getName();

    //key反序列化器
    private String valueSerializer = StringSerializer.class.getName();

    //统一client
    //private String clientId = "default";

    //request.Timeout.Ms 请求超时时间
    private Long requestTimeoutMs = 5000L;

    /**
     * acks
     */
    private String acks = "all";

    /**
     * 是否失败重试：0不重试，大于0会重试
     */
    private Integer retries = 0;

    /**
     * 批处理消息大小（单位：字节）：缓冲超出此值就把消息发送到服务器
     */
    private Integer batchSize = 16384;

    /**
     * 批处理时间间隔（单位：毫秒）：缓冲时间超过此值就把消息发送到服务器
     * 1秒
     */
    private Long lingerMs = 1000L;

    /**
     * 当前生产者使用的最大内存数量（单位：字节）
     * 32M
     */
    private Long bufferMemory = 1024 * 1024 * 5L;

    public String getBootstrapServers() {
        return bootstrapServers;
    }

    public void setBootstrapServers(String bootstrapServers) {
        this.bootstrapServers = bootstrapServers;
    }

    public String getKeySerializer() {
        return keySerializer;
    }

    public void setKeySerializer(String keySerializer) {
        this.keySerializer = keySerializer;
    }

    public String getValueSerializer() {
        return valueSerializer;
    }

    public void setValueSerializer(String valueSerializer) {
        this.valueSerializer = valueSerializer;
    }

    public Long getRequestTimeoutMs() {
        return requestTimeoutMs;
    }

    public void setRequestTimeoutMs(Long requestTimeoutMs) {
        this.requestTimeoutMs = requestTimeoutMs;
    }

    public String getAcks() {
        return acks;
    }

    public void setAcks(String acks) {
        this.acks = acks;
    }

    public Integer getRetries() {
        return retries;
    }

    public void setRetries(Integer retries) {
        this.retries = retries;
    }

    public Integer getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(Integer batchSize) {
        this.batchSize = batchSize;
    }

    public Long getLingerMs() {
        return lingerMs;
    }

    public void setLingerMs(Long lingerMs) {
        this.lingerMs = lingerMs;
    }

    public Long getBufferMemory() {
        return bufferMemory;
    }

    public void setBufferMemory(Long bufferMemory) {
        this.bufferMemory = bufferMemory;
    }
}
